

class tiger(): #老虎--类
    typename ='tiger' #类属性（静态属性）整个类都可以调用的
    def __init__(self,weight):
        self.weight=weight
        print('我是初始化方法')

    def roar(self):
        print('wow!!!')
        self.weight -= 5
    def feed(self,food):
        if food =='肉':
            self.weight += 10
            print('喂食正确')
        else:
            self.weight -= 10
            print('喂食错误')
    #静态方法（类方法）
    @staticmethod
    def tell():
        print('我是类方法+++，整个类都可以使用我')

class sheep:
    typename='sheep'
    pass

class room: #房间-类
    typename='room'
    def __init__(self,num,animal):
        self.num=num
        self.animal=animal

# t1=tiger(100) #创建实例t1(实例化属性)
# print(t1.typename)
# t1.tell()
# print(t1.weight)
# t1.roar()
# print('叫后的体重：',t1.weight)
# tiger(100).feed('肉')
# print('喂食后的体重',tiger(100).weight)
# t1.tell()
# tiger.tell()
# r1=room(1,t1)
# print(r1.animal.weight)
# r2=room(5,tiger(200))
# print(r2.animal.weight)
# r2.animal.feed('肉')
# print(r2.animal.weight)
# print(t1.typename)
# print(tiger.typename)
# print(t1.weight)

class soutiger(tiger):
    pass

    souname='华南地区'
    def __init__(self,weight):
        tiger.__init__(self,weight)

    def roar(self): #方法重写（多太体现）
        print('我是华南虎（子类）roar')

t2=soutiger(180)
print(t2.typename)
t2.tell()
print(t2.weight)
print(t2.souname)
t2.roar()
super(soutiger,t2).roar() #方法重写，调用父类的方法soutiger
#